#-------------------------------
# name: travis bagley
# period: 2
# date started: 9/17/13
#-------------------------------
swearFilter = ["bitch",
               "cunt",
                "ass",
                "slut",
                "dick",
                "pussy",
                "penis",
                "pussy licker",
                "fuck",
                "anal",
                "anus",
                "stupid",
                "retard",
                "nigger",
                "whore",
                "vagina",
                "shit",
                "dong",
                "fuck",
                "homo"]

def displayStartScreen():
    print "Madlibs"
    raw_input("Press Enter to Continue")
    
def displayEndScreen():
    print "Goodbye"
    raw_input("Press Enter to Exit")
 
def getMenuOption(maxOption):
    option = ""
    goodOption = False
    while not goodOption:
        option = raw_input("Enter Number or Q> ")
        option = option.upper()
        for num in range(1, maxOption+1):
            if option == str(num):
                goodOption = True
        if option == 'Q':
            goodOption = True
        if not goodOption:
            print "Please pick a valid option!"
    return option
    
def menu():
    print "-------please select a story--------"
    print "[1] christmas"
    print "[2] paintball"
    print "[Q] quit"
    print"-----------------"
    option = getMenuOption(2)
    return option

                   
def getColor(prompt):
    
    opt = ""
    goodColor = False
    while not goodColor:
        opt = raw_input(prompt)
        if opt.lower() in colors:
            goodColor = True
        else:
            print opt + " is not a valid color, "
    if opt == "black":
        color = '0'
    elif opt == 'blue':
        color = '1'
    elif opt == 'green':
        color = '2'
    elif opt == 'bright white':
        color = 'F'
    elif opt == 'light red':
        color = 'C'
    elif opt == 'red':
        color = '4'
    return color
    
def getWord(prompt):
    word = ""
    goodWord = False
    while not goodWord:
        word = raw_input(prompt)
        if word.lower() not in swearFilter:
            goodWord = True
        else:
            print "Naughty player...please be polite."
        if not goodWord:
            print "Try again"
    return word
    
def getNumber(prompt, max = "", min = ""):
    num = ""
    goodNum = False
    while not goodNum:
        isNum = True
        num = raw_input(prompt)
        for character in num:
            if character not in "0123456789":
                isNum = False
        if min != "":
            if isNum:
                if float(num) < min:
                    isNum = False
        if max != "":
            if isNum:
                if float(num) > max:
                    isNum = False
        if isNum:
            goodNum = True
        else:
            print "Not a valid number, try again."
    return num
                
def christmas():
    place1 = getWord("enter a place: ")
    name = getWord("entername: ")
    day = getWord("day of the week: ")
    noun1 = getWord("enter a noun: ")
    noun2 = getWord("enter another noun: ")
    verb1 = getWord("enter an ajetive: ")
    verb2 = getWord("adjetive please: ")
    story = "it was christmas in"
    story += " " + place1 + ","
    story += "as i recall christmas fell on a"
    story += " " + day + "."
    story += "a small boy named"
    story += " " + name + " "
    story += 'asked "can i open my'
    story += " " + noun1 + ' ' + 'mommy."' + " "
    story += '"no you have to wait for your'
    story += " " + noun2 + '"' + "said mommy" + " "
    story += "the small boy"
    story += " " + verb1 + " " + "into his room."
    story += "the small boy ran to his window and "
    story += " " + verb2 + " " 
    print story
    print
    
    
def paintball():
    name1 = getWord("entername: ")
    name2 = getWord("enter another name: ")
    name3 = getWord("enter another name: ")
    verb1 = getWord("enter an verb: ")  
    adjetive1 = getWord("enter an adjetive: ")
    verb2 = getWord("enter an verb past tense: ")
    story = "There was a boy named"
    story += " " + name1 + "."
    story += "He decided to play paintball with his friends"
    story += " " + name2 + " and "+ name3 + "."
    story += "The three of them were chased so they had to"
    story += " " + verb1 + " away."
    story += "They all fell down a hole it was"
    story += " " + adjetive1 + " " + "in the hole."
    story += "The three of them had to"
    story += " " + verb2 + " " + "to get out of the hole"
    print story
    print


def run():
    displayStartScreen()
    choice = ""
    while choice != 'Q':
        choice = menu()
        if choice == '1':
            christmas()
        if choice == '2':
            paintball()
        elif choice == 'Q':
            displayEndScreen()
        else:
            print "You broke the stupid thing"

        
run()